create or replace package m4o_buffer_impl as

  subtype t is number;

  -- ===========================================================================
  function create_handle(
    i_subst_start_tag in varchar2,
    i_subst_end_tag   in varchar2)
  return t;

  -- ===========================================================================
  procedure free_handle(i_handle in t);

  -- ===========================================================================
  function fmt(
    i_handle in t,
    i_str    in varchar2)
   return varchar2;

  -- ===========================================================================
  procedure p(
    i_handle in t,
    i_str    in varchar2,
    i_fmt    in boolean);

  -- ===========================================================================
  procedure set_subst(
    i_handle in t,
    i_key    in varchar2,
    i_value  in varchar2);

  -- ===========================================================================
  function get_str(i_handle in t) return varchar2;

  -- ===========================================================================
  function get_buf(i_handle in t) return m4o_v2.tbl_t;

  -- ===========================================================================
  procedure clear_buffer(
    i_handle      in t,
    i_clear_subst in boolean := false);

end;
/
